<template>
    <div class="layout-container">
        <n-layout class="layout">
            <n-layout-header class="header-container" bordered>
                <div class="logo-container">
                    <n-icon size="45" color="#0e7a0d">
                        <address-card-regular />
                    </n-icon>
                    <h1>ECBS</h1>
                </div>
                <div class="blank"/>
                <div class="logout-container">
                    <n-button
                          size="large"
                          ghost
                          type="success"
                          @click="logout"
                    >
                        log out
                    </n-button>
                </div>
            </n-layout-header>
            <n-layout has-sider class="body-container">
                <n-layout-sider
                      collapse-mode="transform"
                      show-trigger="arrow-circle"
                      :width="350"
                      bordered
                >
                    <navigator />
                </n-layout-sider>
                <n-layout-content class="content-container">
                    <router-view />
                </n-layout-content>
            </n-layout>
        </n-layout>
    </div>
</template>

<script>
import Navigator from '../components/Navigator'
import { AddressCardRegular } from '@vicons/fa'
export default {
    name: 'LayOut',
    components: {
        Navigator,
        AddressCardRegular
    },
    props: {
        identity: {
            type: String,
            default: ''
        }
    },
    computed: {
    },
    data() {
        return {
        
        }
    },
    methods: {
        logout() {
            this.$router.push('/')
            this.$store.commit('clearToken')
        }
    }
}
</script>

<style scoped lang="less">
.layout-container {
    position: absolute;
    height: 100%;
    width: 100%;
    box-sizing: border-box;
}
.layout, .body-container {
    height: 100%;
}
.header-container {
    position: relative;
    display: flex;
    flex-direction: row;
    padding: 10px;
    
    .logo-container, .logout-container {
        display: flex;
        flex-direction: row;
        align-items: center;
        justify-content: center;
    }
    
    .logout-container {
        margin-right: 10px;
    }
    .logo-container, .logo-container h1 {
        margin-left: 10px;
    }
}
.blank {
    width: 100%;
}
</style>

<style lang="less">

</style>